//
//  UIFont+CT.swift
//  CodingTest
//
//  Created by LYPC on 2021/11/18.
//

import UIKit

// MARK:- 字体相关
public extension UIFont {
    
    static func light(_ size: CGFloat, isFit: Bool = true) -> UIFont {
        return UIFont.systemFont(ofSize: size.fit(isFit), weight: .light)
    }
    static func regular(_ size: CGFloat, isFit: Bool = true) -> UIFont {
        return UIFont.systemFont(ofSize: size.fit(isFit), weight: .regular)
    }
    static func medium(_ size: CGFloat, isFit: Bool = true) -> UIFont {
        return UIFont.systemFont(ofSize: size.fit(isFit), weight: .medium)
    }
    static func semiBold(_ size: CGFloat, isFit: Bool = true) -> UIFont {
        return UIFont.systemFont(ofSize: size.fit(isFit), weight: .semibold)
    }
    static func bold(_ size: CGFloat, isFit: Bool = true) -> UIFont {
        return UIFont.systemFont(ofSize: size.fit(isFit), weight: .bold)
    }
}

extension CGFloat {
    fileprivate func fit(_ isFit: Bool) -> CGFloat {
        return isFit ? self.fitR : self
    }
}


